/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jnitestclient;

import br.com.paysmart.experiments.jni.JNITest;

/**
 *
 * @author smartcon
 */
public class JNITestClient {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        JNITest test = new JNITest();
        
        System.out.println("JNITest(2) = "+ test.DoLoopedWork(2,1000));
        System.out.println("JNITest(6) = "+ test.DoLoopedWork(6,1000));
        System.out.println("JNITest(10) = "+ test.DoLoopedWork(10,1000));
                
        
        
        
        int iLoopedWork = 0;
        long begin = 0, end = 0;
        
        for (int k=0; k<10; k++)
        {
            begin = System.nanoTime();
            for (int i=0; i<1000; i++)
            {        
                iLoopedWork = test.DoLoopedWork(1000,10);
            }
            end = System.nanoTime();
            System.out.println("[JNI Calls] = "+ iLoopedWork+"  totalTime = "+((end-begin)/1000000)+"ms");

            begin = System.nanoTime();
            iLoopedWork = test.DoLoopedWork(1000,10000);
            end = System.nanoTime();

            System.out.println("[Native Calls] = "+ iLoopedWork+"  totalTime = "+((end-begin)/1000000)+"ms");
        }
        
        
    }
}
